package edu.hcmiu.portal.model;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;


public class hook_categoryClp extends BaseModelImpl<hook_category>
    implements hook_category {
    private long _catID;
    private String _catName;
    private String _catDescription;

    public hook_categoryClp() {
    }

    public long getPrimaryKey() {
        return _catID;
    }

    public void setPrimaryKey(long pk) {
        setCatID(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Long(_catID);
    }

    public long getCatID() {
        return _catID;
    }

    public void setCatID(long catID) {
        _catID = catID;
    }

    public String getCatName() {
        return _catName;
    }

    public void setCatName(String catName) {
        _catName = catName;
    }

    public String getCatDescription() {
        return _catDescription;
    }

    public void setCatDescription(String catDescription) {
        _catDescription = catDescription;
    }

    public hook_category toEscapedModel() {
        if (isEscapedModel()) {
            return this;
        } else {
            hook_category model = new hook_categoryClp();

            model.setEscapedModel(true);

            model.setCatID(getCatID());
            model.setCatName(HtmlUtil.escape(getCatName()));
            model.setCatDescription(HtmlUtil.escape(getCatDescription()));

            model = (hook_category) Proxy.newProxyInstance(hook_category.class.getClassLoader(),
                    new Class[] { hook_category.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public Object clone() {
        hook_categoryClp clone = new hook_categoryClp();

        clone.setCatID(getCatID());
        clone.setCatName(getCatName());
        clone.setCatDescription(getCatDescription());

        return clone;
    }

    public int compareTo(hook_category hook_category) {
        long pk = hook_category.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        hook_categoryClp hook_category = null;

        try {
            hook_category = (hook_categoryClp) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        long pk = hook_category.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return (int) getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{catID=");
        sb.append(getCatID());
        sb.append(", catName=");
        sb.append(getCatName());
        sb.append(", catDescription=");
        sb.append(getCatDescription());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("edu.hcmiu.portal.model.hook_category");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>catID</column-name><column-value><![CDATA[");
        sb.append(getCatID());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>catName</column-name><column-value><![CDATA[");
        sb.append(getCatName());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>catDescription</column-name><column-value><![CDATA[");
        sb.append(getCatDescription());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
